--- title: "1、奖券数目" created: 2025-11-28 tags: - 算法 --- # 1、奖券数目 ## 题目 [奖券数目](https://www.lanqiao.cn/problems/673/learning/?isWithAnswer=true) ![[image-d25334c1.png]] ## 思路分析 直接循环 把每一个数拆解出每一位 发现有4就break 并标记为flase 如果某数标记为true 就cnt++ ![[image-eaae9bae.png]] ## 代码实现 ```cpp #include using namespace std; #define endl '\n' int main() { ios::sync_with_stdio(0),cin.tie(0),cout.tie(0); int cnt=0; for(int i=10000;i<=99999;i++){ int x=i; bool havenot4=true; while(x){ if(x%10==4){ havenot4=false; break; } x/=10; } if(havenot4) cnt++; } cout<